var i;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var EventManager = require("AA_EventManager");
var ResKeeper = require("AA_ResKeeper");
var LodingGuodu_UIBindings = require("AA_LodingGuodu_UIBindings");
var EvenType = require("AA_EvenType");
var _decorator = cc._decorator;
var _ccclass = _decorator.ccclass;
var _property = _decorator.property;

var _def_LodingGuodu = function (e) {
  function _creator() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.auto_ui = null;
    t.loadLb = null;
    t.maxnumber = 100;
    t.pronumber = 0;
    return t;
  }
  __extends(_creator, e);
  _creator.prototype.onEnable = function () {
    cc.game.addPersistRootNode(this.node);
    this.auto_ui.node_img.opacity = 0;
    EventManager.EventMgr.addEventListener(EvenType.EVENT_TYPE.Game_Load_View, this.onViewLoad, this);
  };
  _creator.prototype.onViewLoad = function (e) {
    if (e) {
      cc.tween(this.auto_ui.node_img).to(.2, {
        opacity: 255
      }).start();
      this.pronumber = 0;
    } else {
      cc.tween(this.auto_ui.node_img).to(.2, {
        opacity: 0
      }).start();
    }
  };
  _creator.prototype.onDisable = function () {
    EventManager.EventMgr.rmEventListener(EvenType.EVENT_TYPE.Game_Load_View, this.onViewLoad, this);
  };
  _creator.prototype.update = function () {
    if (255 == this.auto_ui.node_img.opacity) {
      this.pronumber += 1;
      var e = Math.round(this.pronumber / this.maxnumber * 100);
      e > 100 && (e = 100);
      this.loadLb.string = e + "%";
    }
  };
  __decorate([_property(LodingGuodu_UIBindings.default)], _creator.prototype, "auto_ui", undefined);
  __decorate([_property(cc.Label)], _creator.prototype, "loadLb", undefined);
  return __decorate([_ccclass], _creator);
}(ResKeeper.default);
exports.default = _def_LodingGuodu;